package day3;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class KgcTest {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        KgcClass java78=new KgcClass();
        java78.name="牛x的java78";
        java78.dirTeacher="Old Liu";
        int choice=0;
        while (true){
            System.out.println("1:加新生,2:查看信息，3:查找,4：按照范围查找，8：退出");
            choice=in.nextInt();
            if(choice==1){
                System.out.print("请输入新生的姓名：");
                String sname=in.next();
                java78.add(sname);
            }else if(choice==2){
                java78.showInformation();
            }else if(choice==3){
                System.out.print("找谁？");
                String name=in.next();
                boolean exists = java78.searchName2(name);
                System.out.println(exists?"在":"不在");
            }else if(choice==4){
                System.out.print("请输入起点：");
                int start=in.nextInt();
                System.out.print("请输入终点：");
                int end=in.nextInt();
                System.out.print("找谁：");
                String name=in.next();
                boolean exists=java78.searchName(start,end,name);
                if(exists){
                    System.out.println(name+"在这个班");
                }else{
                    System.out.println(name+"不在这个班");
                }
            }else if(choice==8){
                break;
            }
        }
    }
}
